﻿<UserControl x:Class="dotNails.UI.ConventionConfig"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:dotNails="clr-namespace:dotNails.UI"
    Width="526" Height="314">

	<UserControl.Resources>
		<ResourceDictionary>
			<ResourceDictionary.MergedDictionaries>
				<ResourceDictionary Source="Styles.xaml"/>
				<ResourceDictionary Source="VectorIcons.xaml"/>
			</ResourceDictionary.MergedDictionaries>
		</ResourceDictionary>
	</UserControl.Resources>

	<Grid>
		<Grid.RowDefinitions>
			<RowDefinition Height="45"/>
			<RowDefinition Height="*"/>
		</Grid.RowDefinitions>

		<Grid>
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="*"/>
			</Grid.ColumnDefinitions>

			<Border Style="{StaticResource HeaderBorder}">
				<StackPanel Orientation="Horizontal">
					<Button Name="btnBack" Click="GoBack" MinWidth="0" MinHeight="0" Width="20" Height="20" IsTabStop="false" Margin="10 0 0 0">
						<Image Stretch="Fill" Source="{StaticResource iconBack}" Width="20" Height="20" />
					</Button>
					<TextBlock Text="Convention Configuration" Style="{StaticResource H1}"  />
				</StackPanel>
			</Border>
		</Grid>

		<ScrollViewer Grid.Row="1" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
			<StackPanel>
				<Expander IsExpanded="True" Margin="10,10,10,0">
					<Expander.Header>
						<StackPanel Orientation="Horizontal" Width="475" Height="60">
							<TextBlock Text="Excluded Columns" Style="{StaticResource Text}" FontSize="18" FontWeight="bold"/>
							<TextBlock Text="Columns in this list will never have values inserted or updated in the database, but will still remain available for selects. Useful for columns handled by triggers." Width="300" TextWrapping="Wrap" Style="{StaticResource Text}" FontSize="12" Foreground="{DynamicResource Text2Brush}"/>
						</StackPanel>
					</Expander.Header>
					<Expander.Content>
						<StackPanel Orientation="Vertical">
							<Grid>
								<Grid.ColumnDefinitions>
									<ColumnDefinition Width="340"/>
									<ColumnDefinition Width="*"/>
								</Grid.ColumnDefinitions>
								<Grid.RowDefinitions>
									<RowDefinition Height="*"/>
									<RowDefinition Height="35"/>
								</Grid.RowDefinitions>
								<!--<StackPanel Orientation="Horizontal">
								<TextBlock Text="TStampYo" Style="{StaticResource Text}" />
								<Button x:Name="btnDeleteExcludedColumn" Click="DeleteExcludedColumn" CommandParameter="{Binding DBName}" Height="22" Width="22" VerticalAlignment="Center" Margin="10 3 0 0">
										<Image Source="{StaticResource iconDelete}" Width="12" Height="12" />
								</Button>
							</StackPanel>-->
								<ItemsControl Grid.Row="0" x:Name="ExcludedDBColumns" Style="{StaticResource Databases}">
									<ItemsControl.ItemTemplate>
										<DataTemplate>
											<StackPanel Orientation="Horizontal">
												<TextBlock Text="{Binding DBName}" Style="{StaticResource Text}" />
												<Button x:Name="btnDeleteExcludedColumn" HorizontalAlignment="Right" Click="DeleteExcludedColumn" CommandParameter="{Binding DBName}" Height="22" Width="22" VerticalAlignment="Center" Margin="10 3 0 0">
													<Image Source="{StaticResource iconDelete}" Width="12" Height="12" />
												</Button>
											</StackPanel>
										</DataTemplate>
									</ItemsControl.ItemTemplate>
								</ItemsControl>
								<StackPanel Grid.Row="1" x:Name="NewExcludedColumnPanel">
									<Button Click="NewExcludedColumn" CommandParameter="{Binding DBName}" Height="22" Width="22" VerticalAlignment="Center" Margin="10 3 0 0" HorizontalAlignment="Left">
										<Image Source="{StaticResource iconAdd}" Width="14" Height="14" />
									</Button>
								</StackPanel>
								<StackPanel Grid.Row="1" x:Name="AddExcludedColumnPanel" Orientation="Horizontal" HorizontalAlignment="Left" Visibility="Hidden">
									<TextBox x:Name="txtExcludedColumn" Height="28" Width="200" />
									<Button x:Name="btnAddExcludedColumn" Click="AddExcludedColumn" CommandParameter="{Binding DBName}" IsDefault="True" Height="25" Width="60" VerticalAlignment="Center" Margin="10 3 0 0">
										<StackPanel Orientation="Horizontal">
											<Image Source="{StaticResource iconCheck}" Width="15" Height="15" />
											<TextBlock Text="Save" Margin="3 0 0 0" />
										</StackPanel>
									</Button>
									<Button x:Name="btnCancelExcludedColumn" Click="CancelExcludedColumn" IsCancel="True" Height="25" Width="60" VerticalAlignment="Center" Margin="10 3 0 0">
										<StackPanel Orientation="Horizontal">
											<Image Source="{StaticResource iconDelete}" Width="14" Height="14" />
											<TextBlock Text="Cancel" Margin="3 0 0 0" />
										</StackPanel>
									</Button>
								</StackPanel>
							</Grid>
						</StackPanel>
					</Expander.Content>
				</Expander>
			</StackPanel>
		</ScrollViewer>

	</Grid>

</UserControl>

